package com.quasar.hpatient.view.adapter;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2016/11/29.
 */

public class MyPagerAdapter extends FragmentPagerAdapter {
    public List<Fragment> fragments = new ArrayList();
    public List<String> titles = new ArrayList();

    public MyPagerAdapter(FragmentManager fm) {
        super(fm);
    }

    public Fragment getItem(int arg0) {
        return (Fragment)this.fragments.get(arg0);
    }

    public int getCount() {
        return this.fragments.size();
    }

    public CharSequence getPageTitle(int position) {
        return (CharSequence)this.titles.get(position);
    }

    public void add(String title, Fragment fragment) {
        this.fragments.add(fragment);
        this.titles.add(title);
    }
}
